﻿layui.use('element', function () {
    var element = layui.element;
    var $ = layui.jquery;
    $('.layui-nav-child a').click(function () {
        var options = eval("(" + $(this).data('options') + ")");

        var title = options.title;
        var url = options.url;
        var id = options.id;
        var length = $('.layui-tab-title li[lay-id=' + id + ']').length;
        var openTitle = '';
        openTitle += '<i class="layui-icon"  style="font-size:16.5px; color: #1E9FFF;">&#xe62a;</i>';
        openTitle += '<span>&nbsp;&nbsp;</span>';
        openTitle += '<span>' + title + '</span>';
        if (length <= 0) {
            element.tabAdd("docDemoTabBrief", {
                title: openTitle,
                content: "<iframe src=" + url + " frameborder='0'  style='height:100vh;width:100%'></iframe>",
                id: id
            })
        }
        element.tabChange("docDemoTabBrief", id)
    });
    $.post("/Account/", function (result) {
        
        var departments = JSON.parse(result.data);
        var deptSelect = $("#deptSelect");
        layui.each(departments, function (index, data) {
            var deptOption = $("<option value='" + data.Id + "'>" + data.TaskTypeName + "</option>");
            deptSelect.append(deptOption);
        });
        form.render();
    });

});